package introspector;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

public class TestIntrospector {
    public  static void main(String [] args) throws IntrospectionException, InvocationTargetException, IllegalAccessException {

        Student student=new Student("xcy",11);
        PropertyDescriptor propertyDescriptor=new PropertyDescriptor("name",Student.class);
        Method method=propertyDescriptor.getReadMethod();
        Object returnDate= method.invoke(student,null);
        System.out.println(returnDate);

        BeanInfo beanInfo= Introspector.getBeanInfo(Student.class);
        PropertyDescriptor[] propertyDescriptors=beanInfo.getPropertyDescriptors();
        for (PropertyDescriptor descriptor:propertyDescriptors)
        {
            System.out.println(descriptor.getName());
        }
        //System.out.println(Thread.currentThread().getContextClassLoader());
        System.out.println(TestIntrospector.class.getClassLoader().getParent());


    }
}
